package cz.data.gateway.api.controller;

import org.springframework.cloud.gateway.route.RouteDefinition;
import org.springframework.cloud.gateway.route.RouteDefinitionRepository;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

import javax.annotation.Resource;

@RestController
public class RouteController {

    @Resource
    RouteDefinitionRepository routeDefinitionRepository;

    @GetMapping("/_routes")
    public Flux<RouteDefinition> routes() {
        return routeDefinitionRepository.getRouteDefinitions();
    }
}
